/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * mainView.java
 *
 * Created on 29 Jun 11, 13:15:10
 */

package dudinzpos;
import MasterData.Barang;
//import MasterData.Suplier;
import MasterData.Biaya;
import MasterData.Customer;
import MasterData.Golongan;
import MasterData.Suplier;
import Transaksi.Pembelian;
import Transaksi.Penjualan;
import koneksi.koneksi;
import com.jtattoo.plaf.bernstein.BernsteinLookAndFeel;
import java.awt.event.KeyEvent;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import property.theme;
import javax.swing.Timer;


/**
 *
 * @author UserXP
 */
public class mainView extends javax.swing.JFrame {

public void menuAwal(){
    MenuFile.setEnabled(true);
    MenuMasterData.setEnabled(false);
    MenuTransaksi.setEnabled(false);
    MenuLaporan.setEnabled(false);
    MenuUtility.setEnabled(false);
    MenuHelp.setEnabled(false);
    MenuItemLogout.setEnabled(false);
    MenuItemLogin.setEnabled(true);


}
public void menuAdmin(){
    MenuFile.setEnabled(true);
    MenuMasterData.setEnabled(true);
    MenuTransaksi.setEnabled(true);
    MenuLaporan.setEnabled(true);
    MenuUtility.setEnabled(true);
    MenuHelp.setEnabled(true);
    MenuItemLogin.setEnabled(false);
    MenuItemLogout.setEnabled(true);
}
public void menuKasir(){
    MenuFile.setEnabled(true);
    //MenuMasterData.setEnabled(true);
    MenuTransaksi.setEnabled(true);
    MenuLaporan.setEnabled(true);
    MenuUtility.setEnabled(true);
    MenuHelp.setEnabled(true);
    MenuItemLogin.setEnabled(false);
    MenuItemLogout.setEnabled(true);
}
    /** Creates new form mainView */
public void initLogin(){
    Login.setSize(300, 165);
    Login.setLocationRelativeTo(this);
    Login.setVisible(true);
    txtUsername.setText("");
    txtPassword.setText("");
    txtUsername.requestFocus();
    menuAwal();
}
public void initRubahPass(){
    RubahPass.setSize(180, 200);
    RubahPass.setLocationRelativeTo(this);
    RubahPass.setVisible(true);
    txtPassBaru.setText("");
    txtConfPassBaru.setText("");
    txtPassBaru.requestFocus();
}


    public mainView() {
        /*theme.temaUtama();
         * 
         */
        initComponents();
        initLogin();
        
            }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Login = new javax.swing.JDialog();
        jPanel3 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        btnLogin = new javax.swing.JButton();
        btnBatal = new javax.swing.JButton();
        txtUsername = new com.uiMIF.JTextEx();
        txtPassword = new com.uiMIF.JPasswordEx();
        RubahPass = new javax.swing.JDialog();
        jPanel4 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        btnChangePass = new javax.swing.JButton();
        btnBatalChangePass = new javax.swing.JButton();
        txtPassBaru = new javax.swing.JPasswordField();
        txtConfPassBaru = new javax.swing.JPasswordField();
        jPanel1 = new javax.swing.JPanel();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        NamaOperator = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        MenuFile = new javax.swing.JMenu();
        MenuItemLogin = new javax.swing.JMenuItem();
        MenuItemLogout = new javax.swing.JMenuItem();
        MenuItemSettingDB = new javax.swing.JMenuItem();
        MenuItemExit = new javax.swing.JMenuItem();
        MenuMasterData = new javax.swing.JMenu();
        MenuItemStokBarang = new javax.swing.JMenuItem();
        MenuItemSuplier = new javax.swing.JMenuItem();
        MenuItemCustomer = new javax.swing.JMenuItem();
        MenuItemGolongan = new javax.swing.JMenuItem();
        MenuItemBiaya = new javax.swing.JMenuItem();
        MenuTransaksi = new javax.swing.JMenu();
        MenuItemPembelian = new javax.swing.JMenuItem();
        MenuItemPenjualan = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenuItem15 = new javax.swing.JMenuItem();
        jMenuItem16 = new javax.swing.JMenuItem();
        MenuLaporan = new javax.swing.JMenu();
        MenuUtility = new javax.swing.JMenu();
        MenuItemTutupHari = new javax.swing.JMenuItem();
        MenuItemGantiPassword = new javax.swing.JMenuItem();
        MenuHelp = new javax.swing.JMenu();
        MenuItemManualBook = new javax.swing.JMenuItem();
        MenuItemAbout = new javax.swing.JMenuItem();

        Login.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        Login.setTitle(" Login");
        Login.setAlwaysOnTop(true);
        Login.setIconImage(null);

        jLabel2.setText("Username");

        jLabel3.setText("Password");

        btnLogin.setText("Login");
        btnLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLoginActionPerformed(evt);
            }
        });
        btnLogin.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                btnLoginKeyTyped(evt);
            }
        });

        btnBatal.setText("Batal");
        btnBatal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBatalActionPerformed(evt);
            }
        });

        txtUsername.setMaxlength(20);
        txtUsername.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtUsernameKeyTyped(evt);
            }
        });

        txtPassword.setMaxlength(20);
        txtPassword.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtPasswordKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addGap(28, 28, 28)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtUsername, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(btnLogin)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnBatal)))
                .addContainerGap(23, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnLogin)
                    .addComponent(btnBatal))
                .addContainerGap(25, Short.MAX_VALUE))
        );

        Login.getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);

        RubahPass.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        RubahPass.setTitle("Rubah Password");

        jLabel5.setText("Password Baru");

        jLabel6.setText("Konfirmasi Password Baru");

        btnChangePass.setText("OK");
        btnChangePass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnChangePassActionPerformed(evt);
            }
        });
        btnChangePass.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                btnChangePassKeyTyped(evt);
            }
        });

        btnBatalChangePass.setText("Batal");
        btnBatalChangePass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBatalChangePassActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel6)
                    .addComponent(jLabel5)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(btnChangePass)
                        .addGap(10, 10, 10)
                        .addComponent(btnBatalChangePass))
                    .addComponent(txtPassBaru, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
                    .addComponent(txtConfPassBaru))
                .addContainerGap(22, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtPassBaru, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtConfPassBaru, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnBatalChangePass)
                    .addComponent(btnChangePass))
                .addContainerGap(16, Short.MAX_VALUE))
        );

        RubahPass.getContentPane().add(jPanel4, java.awt.BorderLayout.CENTER);

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Aplikasi Penjualan Mitra 226 Frozen Food");

        jPanel1.setLayout(new java.awt.BorderLayout());
        jPanel1.add(jDesktopPane1, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setText("Copyright©2011 by imaduddin 08.11.0556");

        NamaOperator.setFont(new java.awt.Font("Tahoma", 1, 18));
        NamaOperator.setText("- tidak ada -");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel4.setText("Operator Aktif :");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 138, Short.MAX_VALUE)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(NamaOperator)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(NamaOperator)
                    .addComponent(jLabel4))
                .addContainerGap())
        );

        getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);

        MenuFile.setText("File");

        MenuItemLogin.setText("Login");
        MenuItemLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemLoginActionPerformed(evt);
            }
        });
        MenuFile.add(MenuItemLogin);

        MenuItemLogout.setText("Logout");
        MenuItemLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemLogoutActionPerformed(evt);
            }
        });
        MenuFile.add(MenuItemLogout);

        MenuItemSettingDB.setText("Setting Database");
        MenuItemSettingDB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemSettingDBActionPerformed(evt);
            }
        });
        MenuFile.add(MenuItemSettingDB);

        MenuItemExit.setText("Exit");
        MenuItemExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemExitActionPerformed(evt);
            }
        });
        MenuFile.add(MenuItemExit);

        jMenuBar1.add(MenuFile);

        MenuMasterData.setText("Master Data");

        MenuItemStokBarang.setText("Stok Barang");
        MenuItemStokBarang.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemStokBarangActionPerformed(evt);
            }
        });
        MenuMasterData.add(MenuItemStokBarang);

        MenuItemSuplier.setText("Suplier");
        MenuItemSuplier.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemSuplierActionPerformed(evt);
            }
        });
        MenuMasterData.add(MenuItemSuplier);

        MenuItemCustomer.setText("Customer");
        MenuItemCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemCustomerActionPerformed(evt);
            }
        });
        MenuMasterData.add(MenuItemCustomer);

        MenuItemGolongan.setText("Golongan");
        MenuItemGolongan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemGolonganActionPerformed(evt);
            }
        });
        MenuMasterData.add(MenuItemGolongan);

        MenuItemBiaya.setText("Biaya");
        MenuItemBiaya.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemBiayaActionPerformed(evt);
            }
        });
        MenuMasterData.add(MenuItemBiaya);

        jMenuBar1.add(MenuMasterData);

        MenuTransaksi.setText("Transaksi");

        MenuItemPembelian.setText("Pembelian");
        MenuItemPembelian.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemPembelianActionPerformed(evt);
            }
        });
        MenuTransaksi.add(MenuItemPembelian);

        MenuItemPenjualan.setText("Penjualan");
        MenuItemPenjualan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemPenjualanActionPerformed(evt);
            }
        });
        MenuTransaksi.add(MenuItemPenjualan);

        jMenuItem12.setText("Pendapatan Non Retail");
        MenuTransaksi.add(jMenuItem12);

        jMenuItem13.setText("Biaya - Biaya");
        MenuTransaksi.add(jMenuItem13);

        jMenuItem14.setText("Retur Pembelian");
        MenuTransaksi.add(jMenuItem14);

        jMenuItem15.setText("Retur Penjualan");
        MenuTransaksi.add(jMenuItem15);

        jMenuItem16.setText("Penyesuaian Stok Barang");
        MenuTransaksi.add(jMenuItem16);

        jMenuBar1.add(MenuTransaksi);

        MenuLaporan.setText("Laporan");
        jMenuBar1.add(MenuLaporan);

        MenuUtility.setText("Utility");

        MenuItemTutupHari.setText("Tutup Hari");
        MenuUtility.add(MenuItemTutupHari);

        MenuItemGantiPassword.setText("Ganti Password");
        MenuItemGantiPassword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemGantiPasswordActionPerformed(evt);
            }
        });
        MenuUtility.add(MenuItemGantiPassword);

        jMenuBar1.add(MenuUtility);

        MenuHelp.setText("Help");

        MenuItemManualBook.setText("Manual Book");
        MenuHelp.add(MenuItemManualBook);

        MenuItemAbout.setText("About");
        MenuHelp.add(MenuItemAbout);

        jMenuBar1.add(MenuHelp);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnBatalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBatalActionPerformed
        // TODO add your handling code here:
        Login.setVisible(false);
        MenuFile.setEnabled(true);
    }//GEN-LAST:event_btnBatalActionPerformed

    private void btnLogin(){
      koneksi config = new koneksi();
      config.BuatKoneksiDB();
      try {
          Statement st =
          config.getConnection().createStatement();
            ResultSet rs = st.executeQuery(
             "Select * from tbl_user where pass=MD5('"+
            String.copyValueOf(txtPassword.getPassword(),0,txtPassword.getPassword().length)+
             "')" +
             " and user_name='" + txtUsername.getText() + "'");
            
          if (rs.next()) {
              if(rs.getString(4).equals("admin")){
                  menuAdmin();
              }else{
                  menuKasir();
              }
              Login.setVisible(false);
              NamaOperator.setText(txtUsername.getText());
           } else {
              JOptionPane.showMessageDialog(Login,
                "User ID dan password tidak valid");
              txtUsername.setText("");
              txtPassword.setText("");
              txtUsername.requestFocus();
           }
           
           st.close();
           config.getConnection().close();
           config.dispose();
       }

       catch (SQLException ex) {
           System.out.println(ex);
       }
    }
    private void rubahPassword(){
         koneksi config = new koneksi();
         config.BuatKoneksiDB();
         try{
            Statement st=config.getConnection().createStatement();
            int ubahPass = st.executeUpdate(""+
                "update tbl_user set pass=MD5('" +
               txtPassBaru.getText()+"') where user_name='"+NamaOperator.getText()+"'");
            if (ubahPass==1){
                JOptionPane.showMessageDialog(RubahPass," Ubah Password Sukses !");
                RubahPass.setVisible(false);
                txtPassBaru.setText("");
                txtConfPassBaru.setText("");
                MenuFile.setEnabled(true);
            }
           st.close();
           config.getConnection().close();
           config.dispose();
         }catch(Exception e){
             e.printStackTrace();
             JOptionPane.showMessageDialog(this,"Ubah Password Gagal \nPeriksa SQL !");         }
    }
    private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
        // TODO add your handling code here:
        btnLogin();
    }//GEN-LAST:event_btnLoginActionPerformed

    private void MenuItemExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemExitActionPerformed
        // TODO add your handling code here:
        try{
            int reply=JOptionPane.showConfirmDialog(this, "Apakah yakin mau keluar ?","Aplikasi " +
                    "Penjualan - Exit",JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE);
            if(reply==JOptionPane.YES_OPTION){
                setVisible(false);
                dispose();
                System.out.println("Thank !!!");
                System.out.println("Mitra Frozen © 2011 by dudinz");
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                System.exit(0);
            }
            }catch(Exception e){

            }
    }//GEN-LAST:event_MenuItemExitActionPerformed

    private void MenuItemLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemLoginActionPerformed
        // TODO add your handling code here:
        initLogin();
    }//GEN-LAST:event_MenuItemLoginActionPerformed

    private void MenuItemLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemLogoutActionPerformed
        // TODO add your handling code here:
        menuAwal();
        NamaOperator.setText("- Tidak Ada -");
        jDesktopPane1.removeAll();
        jDesktopPane1.setVisible(false);
    }//GEN-LAST:event_MenuItemLogoutActionPerformed

    private void MenuItemSettingDBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemSettingDBActionPerformed


        // TODO add your handling code here:
        koneksi kon = new koneksi();
        kon.setTitle("Koneksi Database Baru");
        kon.setVisible(true);
    }//GEN-LAST:event_MenuItemSettingDBActionPerformed

    private void MenuItemStokBarangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemStokBarangActionPerformed
        // TODO add your handling code here:
        try{
        Barang frmBr=new Barang();
        jDesktopPane1.add(frmBr, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setVisible(true);
        frmBr.show();
        frmBr.setMaximum(true);
        }catch(Exception e){
            e.printStackTrace();
        }
    }//GEN-LAST:event_MenuItemStokBarangActionPerformed

    private void MenuItemSuplierActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemSuplierActionPerformed
        // TODO add your handling code here:
         try{
        Suplier frmSp=new Suplier();
        jDesktopPane1.add(frmSp, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setVisible(true);
        frmSp.show();
        frmSp.setMaximum(true);
        }catch(Exception e){
            e.printStackTrace();
        }
    }//GEN-LAST:event_MenuItemSuplierActionPerformed

    private void txtUsernameKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtUsernameKeyTyped
        // TODO add your handling code here:
        if(evt.getKeyChar()==evt.VK_ENTER)
            txtPassword.requestFocus();
    }//GEN-LAST:event_txtUsernameKeyTyped

    private void txtPasswordKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPasswordKeyTyped
        // TODO add your handling code here:
        if(evt.getKeyChar()==evt.VK_ENTER)
            btnLogin.requestFocus();
    }//GEN-LAST:event_txtPasswordKeyTyped

    private void btnLoginKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btnLoginKeyTyped
        // TODO add your handling code here:
        if(evt.getKeyChar()==evt.VK_ENTER)
            btnLogin();
    }//GEN-LAST:event_btnLoginKeyTyped

    private void MenuItemCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemCustomerActionPerformed
        // TODO add your handling code here:
         try{
        Customer frmCs=new Customer();
        jDesktopPane1.add(frmCs, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setVisible(true);
        frmCs.show();
        frmCs.setMaximum(true);
        }catch(Exception e){
            e.printStackTrace();
        }
    }//GEN-LAST:event_MenuItemCustomerActionPerformed

    private void MenuItemGolonganActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemGolonganActionPerformed
        // TODO add your handling code here:
        try{
        Golongan frmGl=new Golongan();
        jDesktopPane1.add(frmGl, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setVisible(true);
        frmGl.show();
        frmGl.setMaximum(true);
        }catch(Exception e){
            e.printStackTrace();
        }
    }//GEN-LAST:event_MenuItemGolonganActionPerformed

    private void MenuItemBiayaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemBiayaActionPerformed
        // TODO add your handling code here:
        try{
        Biaya frmBy=new Biaya();
        jDesktopPane1.add(frmBy, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setVisible(true);
        frmBy.show();
        frmBy.setMaximum(true);
        }catch(Exception e){
            e.printStackTrace();
        }
    }//GEN-LAST:event_MenuItemBiayaActionPerformed

    private void btnChangePassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChangePassActionPerformed
        // TODO add your handling code here:
        if(txtPassBaru.getText().equals(txtConfPassBaru.getText())){
           rubahPassword();
           
          

        }else{
            JOptionPane.showMessageDialog(this, "Konfirmasi Password Salah \nSilahkan Ulangi !");
            txtPassBaru.setText(null);
            txtConfPassBaru.setText(null);
            txtPassBaru.requestFocus();
        }
    }//GEN-LAST:event_btnChangePassActionPerformed

    private void btnChangePassKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btnChangePassKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_btnChangePassKeyTyped

    private void btnBatalChangePassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBatalChangePassActionPerformed
        // TODO add your handling code here:
        RubahPass.setVisible(false);
        MenuFile.setEnabled(true);
    }//GEN-LAST:event_btnBatalChangePassActionPerformed

    private void MenuItemGantiPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemGantiPasswordActionPerformed
        // TODO add your handling code here:
        initRubahPass();
    }//GEN-LAST:event_MenuItemGantiPasswordActionPerformed

    private void MenuItemPembelianActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemPembelianActionPerformed
        // TODO add your handling code here:
        try{
        Pembelian frmBeli=new Pembelian();
        jDesktopPane1.add(frmBeli, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setVisible(true);
        frmBeli.show();
        frmBeli.setMaximum(true);
        }catch(Exception e){
            e.printStackTrace();
        }
    }//GEN-LAST:event_MenuItemPembelianActionPerformed

    private void MenuItemPenjualanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemPenjualanActionPerformed
        // TODO add your handling code here:
        try{
            Penjualan frmPjl=new Penjualan();
            jDesktopPane1.add(frmPjl, javax.swing.JLayeredPane.DEFAULT_LAYER);
            jDesktopPane1.setVisible(true);
            frmPjl.show();
            frmPjl.setMaximum(true);
        }catch(Exception e){
            e.printStackTrace();
        }
    }//GEN-LAST:event_MenuItemPenjualanActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new mainView().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDialog Login;
    private javax.swing.JMenu MenuFile;
    private javax.swing.JMenu MenuHelp;
    private javax.swing.JMenuItem MenuItemAbout;
    private javax.swing.JMenuItem MenuItemBiaya;
    private javax.swing.JMenuItem MenuItemCustomer;
    private javax.swing.JMenuItem MenuItemExit;
    private javax.swing.JMenuItem MenuItemGantiPassword;
    private javax.swing.JMenuItem MenuItemGolongan;
    private javax.swing.JMenuItem MenuItemLogin;
    private javax.swing.JMenuItem MenuItemLogout;
    private javax.swing.JMenuItem MenuItemManualBook;
    private javax.swing.JMenuItem MenuItemPembelian;
    private javax.swing.JMenuItem MenuItemPenjualan;
    private javax.swing.JMenuItem MenuItemSettingDB;
    private javax.swing.JMenuItem MenuItemStokBarang;
    private javax.swing.JMenuItem MenuItemSuplier;
    private javax.swing.JMenuItem MenuItemTutupHari;
    private javax.swing.JMenu MenuLaporan;
    private javax.swing.JMenu MenuMasterData;
    private javax.swing.JMenu MenuTransaksi;
    private javax.swing.JMenu MenuUtility;
    private javax.swing.JLabel NamaOperator;
    private javax.swing.JDialog RubahPass;
    private javax.swing.JButton btnBatal;
    private javax.swing.JButton btnBatalChangePass;
    private javax.swing.JButton btnChangePass;
    private javax.swing.JButton btnLogin;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPasswordField txtConfPassBaru;
    private javax.swing.JPasswordField txtPassBaru;
    private com.uiMIF.JPasswordEx txtPassword;
    private com.uiMIF.JTextEx txtUsername;
    // End of variables declaration//GEN-END:variables

}
